Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

python - Module import error even though sys.path shows the directory?

I am having trouble installing a package through its directory (not possible to install through pip, only folder available) on my mac.

I am using a python 2.7 environment on Conda and did the following after reading many posts and tutorials:

  • decompressed the file with the modules I need ("/Users/personal/python_files/PyOPC-0.1/PyOPC")
  • used the command conda develop "path/to/PyOPC" on the terminal
  • added the following line to the bottom of the ~/.bash_profile file: export PYTHONPATH="/path/to/PyOPC"
  • checked my sys.path through python2 -c "import sys; print(' '.join(sys.path))" on the terminal

When I do the latter, I can see the path to PyOPC listed there, so I thought I wouldn't have problems importing any modules.

Nonetheless, when I run my code I get the following:

from basic import BasicXDAServer
ImportError: No module named basic

basic.py is a file inside the folder PyOPC/servers. If I move "basic" to the main PyOPC folder, I get a different import error referring to an import happening within basic.py...

Here is the complete directory I am referring to available on Github: https://github.com/ibh-systems/pyopc/tree/master/PyOPC

Is there a problem with the structure of the directory itself or did I do something wrong as I installed it. Thanks for the help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...