过去两天我试图解决一个问题,我做了一切来解决这个问题。有一个包可用。叫做#34; fragbuilder"。
https://github.com/jensengroup/fragbuilder
我在Django应用程序中使用了这个包。
根据安装说明,我已安装此软件包。
How to use
1) Clone fragbuilder from this repository
git clone https://github.com/andersx/fragbuilder
2) Export the frabuilder directory to your PYTHONPATH eg:
export PYTHONPATH=/home/andersx/dev/fragbuilder:$PYTHONPATH
3) In your Python:
import fragbuilder
此方法适用于我,当我使用我的Django应用程序时,我能够成功运行此应用程序。但是,当我使用native或virtualenv python安装在apache2服务器上部署此应用程序时,它会显示错误,如下所示:
ImportError at /Pep_Des/
No module named fragbuilder
Request Method: GET
Request URL: http://172.16.16.46/Pep_Des/
Django Version: 1.8
Exception Type: ImportError
Exception Value:
No module named fragbuilder
Exception Location: /home/jai/myproject/Peptide_Descriptor/dis_str_gen.py in <module>, line 4
Python Executable: /usr/bin/python
Python Version: 2.7.12
Python Path:
['/home/jai/myproject',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/local/lib/python2.7/dist-packages/geoplotlib-0.3.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/virtualenv-15.1.0-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/sklearn_theano-0.0.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/Theano-0.9.0-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/progress-1.3-py2.7.egg',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/wx-3.0-gtk2',
'/usr/local/lib/python2.7/dist-packages/geoplotlib-0.3.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/progress-1.3-py2.7.egg']
我已经应用了我在整个python编程经验中获得的知识,但遗憾的是没有任何对我有用。
任何人都可以猜出这种令人作呕的python-path行为背后的可能原因
这是我的&#34; 000-default.conf&#34;文件:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
Alias /static /home/jai/myproject/protocol/static
<Directory /home/jai/myproject/protocol/static>
Require all granted
</Directory>
<Directory /home/jai/myproject/pep_learn>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/home/jai/myproject:/usr/local/lib/python2.7/dist-packages
#
WSGIProcessGroup myproject
WSGIScriptAlias / /home/jai/myproject/pep_learn/wsgi.py
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet